package com.vinjogames.util;

import android.graphics.PointF;
import android.util.FloatMath;

public class LineSegmentF {
	private PointFFlagged start;
	private PointFFlagged end;
	
	public LineSegmentF() {
		start = new PointFFlagged();
		end = new PointFFlagged();
	}

	public LineSegmentF(PointF st, PointF ed) {
		start = new PointFFlagged(st.x, st.y);
		end = new PointFFlagged(ed.x, ed.y);
	}
	
	public static float Length(PointF st, PointF ed) {
		return FloatMath.sqrt((st.x - ed.x) * (st.x - ed.x) + (st.y - ed.y) *(st.y - ed.y));
	}
	
	public void initializeSegment(PointFFlagged st, PointFFlagged ed) {
		start.setX(st.getX()); start.setY(st.getY());
		end.setX(st.getX()); end.setY(st.getY());
	}

	public PointFFlagged getStart() { return start; }
	public void setStart(PointFFlagged start) { this.start = start; }
	public PointFFlagged getEnd() { return end; }
	public void setEnd(PointFFlagged end) { this.end = end; }
}
